package com.kwok.rbac.application.controller;

import com.kwok.rbac.application.common.utils.R;
import com.kwok.rbac.application.service.AuthorizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/auth")
public class AuthorizationController {

    @Autowired
    private AuthorizationService authorizationService;

    //根据角色ID给角色赋予权限
    @PostMapping("/privilegeToRole/{roleId}")
    public R givePrivilegeToRole(@PathVariable Integer roleId, @RequestBody List<Integer> privilegeIdList){
        Boolean b = authorizationService.privilegeToRole(roleId, privilegeIdList);
        return R.write(b);
    }

}
